package com.prs.crm.dao.crm.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Property;

import com.prs.crm.dao.crm.SupplierFoodsDao;
import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.domain.crm.CustomerContract;
import com.prs.crm.domain.crm.CustomerSupplier;
import com.prs.crm.domain.crm.Linkman;
import com.prs.crm.domain.crm.SupplierFoods;

public class SupplierFoodsDaoImpl extends BaseDaoImpl<SupplierFoods> implements SupplierFoodsDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<SupplierFoods> getSupplierFoodsByContract(
			CustomerContract customerContract) {
		Criteria criteria = this.getSession().createCriteria(SupplierFoods.class);
		criteria.add(Property.forName("customerContract").eq(customerContract));
		return criteria.list();
	}

	@Override
	public List<SupplierFoods> getSupplierFoodsBySupplier(
			CustomerSupplier customerSupplier) {
		Criteria criteria = this.getSession().createCriteria(SupplierFoods.class);
		criteria.add(Property.forName("customerSupplier").eq(customerSupplier));
		return criteria.list();
	}

}
